package com.yazi.mxz.common.service;

import java.util.List;

import com.yazi.mxz.common.entity.beans.Store;
import com.yazi.mxz.common.entity.beans.StoreGift;
import com.yazi.mxz.common.entity.beans.StorePromote;
import com.yazi.mxz.common.entity.enums.StorePromoteStatus;

import com.myframework.smhj.common.exception.MyException;
import com.myframework.smhj.hibernate.dao.Service;

/**
 * 店铺促销信息Service
 * @author mo_yq5
 * @date 2014-4-4
 */
public interface StorePromoteService extends Service<StorePromote> {
	
	/**
	 * 添加店铺促销
	 * @param store 店铺(游离对象)
	 * @param promote 促销(构建对象)
	 * @param gifts 赠送商品(构建对象)
	 * @return
	 */
	StorePromote addByStore(Store store, StorePromote promote, 
			List<StoreGift> gifts) throws MyException;

	
	/**
	 * 更新店铺促销
	 * @param store 店铺(游离对象)
	 * @param promote 促销(构建对象)
	 * @param gifts 赠送商品(构建对象)
	 * @return
	 */
	StorePromote editByStore(Store store, StorePromote promote, 
			List<StoreGift> gifts) throws MyException;
	
	/**
	 * 结束已经到结束时间的店铺促销
	 * 
	 */
	int endByTime();
	
	/**
	 * 开始已经到开始时间的店铺促销
	 * 
	 */
	int startByTime();
	
	/**
	 * 获取最近一个要开始的店铺促销
	 * @return
	 */
	StorePromote oneNextStart();
	
	/**
	 * 获取最近一个要结束的店铺促销
	 * @return
	 */
	StorePromote oneNextEnd();
	
	/**
	 * 删除店铺促销
	 * @param store 店铺(游离对象)
	 * @param promoteId 要删除的促销ID
	 */
	void removeByStore(Store store, long promoteId);
	
	/**
	 * 更新促销状态，只能进行取消和恢复两个操作
	 * @param store 店铺(游离对象)
	 * @param promoteId 要更新的促销ID
	 * @param status 目标状态
	 */
	void editStatusByStore(Store store, long promoteId, 
			StorePromoteStatus status) throws MyException;
}
